package com.shop.interceptor;

import java.util.Map;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.shop.pojo.AdminInfo;

public class AdminSecurityInterceptor extends AbstractInterceptor{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1016254711003322396L;

	@Override
	@SuppressWarnings("unchecked")
	public String intercept(ActionInvocation invocation) throws Exception {
		Map session=invocation.getInvocationContext().getSession();
		AdminInfo adminInfo=(AdminInfo)session.get(AdminInfo.ADMIN_INFO);
		if(adminInfo==null){
			return "login";
		}
		return invocation.invoke();
		 
	}

}
